package cn.tedu.sp08.feign;

import cn.tedu.sp01.pojo.Item;
import cn.tedu.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
//声明式客户端
@FeignClient(name = "item-service",fallback = ItemClientFB.class)//服务的名称,降级类(因为接口里无法写普通方法)
public interface ItemClient {
    @GetMapping("/{orderId}")//远程服务的路径
    JsonResult<List<Item>> getItems(@PathVariable String orderId);//提交的参数

    @PostMapping("/decreaseNumber")
    JsonResult<?> decreaseNumber(@RequestBody List<Item> items);//从协议体提交的参数
}
